package com.zry.pda

import android.view.View
import com.zry.pda.animation.RecyclerViewUtilKt
import com.zry.pda.databinding.ActivityMainBinding
import com.zry.pda.presenter.MainPresenter
import com.zry.pda.ui.base.BaseActivity
import kotlinx.android.synthetic.main.common_title.*

class MainActivity : BaseActivity() {
    private var mainBinding: ActivityMainBinding? = null
    private var mainPresenter: MainPresenter? = null
    override fun getLayoutId(): Int {
        return R.layout.activity_main
    }

    override fun initData() {
        commonLeftLinearLayout.visibility = View.GONE
        titleCenterText.setText(R.string.app_name)

        mainBinding = viewDataBinding as ActivityMainBinding
        mainPresenter = MainPresenter(this)
        mainBinding?.handlerClick = mainPresenter

        initRecycler()
    }

    private fun initRecycler() {
        recyclerViewUtilKt = RecyclerViewUtilKt(this, mainBinding!!.homePageRecycler)
        recyclerViewUtilKt?.initTableRecyclerView(2, 2)

        mainPresenter?.initAdapter()
        mainPresenter?.initView()
    }

    override fun onResume() {
        super.onResume()
        mainPresenter?.initView()
    }
}
